home *** CD-ROM | disk | FTP | other *** search
- // button.cpp -- Creating a class
-
- //#include <stream.hpp>
- #include <iostream.h>
-
- class button {
- private:
- int isUp;
- public:
- void push(int upDown);
- int state(void);
- };
-
- main()
- {
- button myButton;
-
- myButton.push(1);
- cout << "\nButton state = " << myButton.state();
- myButton.push(0);
- cout << "\nButton state = " << myButton.state();
- }
-
- void button::push(int upDown)
- {
- isUp = upDown;
- }
-
- int button::state(void)
- {
- return isUp;
- }
-
-
- // Copyright (c) 1990 by Tom Swan. All rights reserved
- // Revision 1.00 Date: 09/18/1990 Time: 04:20 pm
-
- // Revision 1.01 Date: 07/03/1991 Time: 09:07 pm
- // Converted for Borland C++ 2.0
-
-